# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models
from django.contrib.auth.models import User
# Create your models here.


class UserProfile(models.Model):
	user = models.OneToOneField(User)
	name = models.CharField(max_length=32)
	signature = models.CharField(max_length=255, blank=True, null=True)
	head_img = models.ImageField(height_field=150, width_field=150, blank=True, null=True)
	friends = models.ManyToManyField('self', related_name='my_friends', blank=True)

	def __unicode__(self):
		return self.name

class ChatGroup(models.Model):
	name = models.CharField(max_length=64)
	brief = models.CharField(max_length=255, blank=True, null=True)
	owner = models.ForeignKey(UserProfile)
	admins = models.ManyToManyField(UserProfile, blank=True, related_name='chatgroup_admins')
	members = models.ManyToManyField(UserProfile, blank=True, related_name='chatgroup_members')
	max_members = models.IntegerField(default=200)

	def __unicode__(self):
		return self.name